package com.zhang.backend.controller;

import com.zhang.backend.entity.Relation;
import com.zhang.backend.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 管理成员之间的关系 (Relation)
 */
@RestController
@RequestMapping("/api/relations")
public class RelationController {

    @Autowired
    private RelationService relationService;

    @PostMapping
    public ResponseEntity<Relation> addRelation(@RequestBody Relation relation) {
        relationService.save(relation);
        return ResponseEntity.ok(relation);
    }
}
